import React, { Component } from 'react'
import { Route,Redirect,Switch } from 'react-router-dom'

import About from './component/About/About'
import Home from './component/Home/Home'
import MyNavLink from './component/MyNavLink/MyNavLink'

export default class  App extends Component {
  render() {
    return (
      <div>
        <div class="row">
          <div class="col-xs-offset-2 col-xs-8">
            <div class="page-header"><h2>React Router Demo</h2></div>
          </div>
        </div>
        <div class="row">
          <div class="col-xs-2 col-xs-offset-2">
            <div class="list-group">
              <MyNavLink to="/about">About</MyNavLink>
              <MyNavLink to="/home">Home</MyNavLink>
              {/* <a class="list-group-item" href="./about.html">About</a>
              <a class="list-group-item active" href="./home.html">Home</a> */}
            </div>
          </div>
          <div class="col-xs-6">
            <div class="panel">
              <div class="panel-body">
                <Switch>
                  <Route path='/about' component={About}></Route>
                  <Route path='/home' component={Home}></Route>
                  <Redirect to='/about'></Redirect>
                </Switch>
                {/* <h3>我是Home的内容</h3> */}
              </div>
            </div>
          </div>
        </div>
      </div>
    )
  }
}
